package com.dommy.tab.util;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.net.URI;
import java.net.URL;

import okhttp3.Call;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

/**
 * imgUtil
 * Created by 光头 on 2020/7/4.
 */

public class ImgUtil {
    static  Bitmap bitmap = null;
    public  static Bitmap getImg(String url) {
            try{
                Request request = new Request.Builder().url(url).build();
                Response response = new OkHttpClient().newCall(request).execute();
                bitmap = BitmapFactory.decodeStream(response.body().byteStream());
            }catch (Exception e){
                System.out.println("Get Img error.............");
                e.printStackTrace();
            }
        return bitmap;
    }
}
